import axios from 'axios'
export default {
    state: {
        valueUrl: '/api/value',
        companys: [],
        topData1: {},
        topData2: {},
        topData3: {},
        bottomData1: {},
        bottomData2: {},
        bottomData3: {},
        barArr: []
    },
    mutations: {
    },
    actions: {
        loadValue({ commit, state }, url) {
            axios({
                method: 'get',
                url: url,
                data: ''
            }).then((res) => {
                if (res.status == 200) {
                    let datas = res.data.value;
                    let companys = datas.value1.OTH00009I[0];
                    let bardta = datas.value2.OTH00010I[0];
                    state.topData1 = datas.value1.OTH00004I[0];
                    state.topData2 = datas.value1.OTH10004I[0];
                    state.topData3 = datas.value1.OTH20004I[0];
                    state.bottomData1 = datas.value1.OTH00004O[0];
                    state.bottomData2 = datas.value1.OTH10004O[0];
                    state.bottomData3 = datas.value1.OTH20004O[0];
                    state.companys = companys;
                    state.barArr = bardta;
                }
                commit('loadNews')
            })
        }
    }
}
